home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir37 / mxmenu.zip / CRAWL.INC next >
Text File  |  1992-11-17  |  2KB  |  109 lines

  1.  
  2. Comment
  3. ==========================================================
  4.  
  5. This section allows for a screen crawl on the bottom line of the screen.
  6. It reads a file and displays it over and over.
  7.  
  8. If TODAY.TXT doesn't exist then no crawl will be displayed.
  9.  
  10. Blank lines in the TODAY.TXT file cause * * * to appear.
  11.  
  12. ==========================================================
  13. EndComment
  14.  
  15.  
  16. ;----- Background Tasking
  17.  
  18. var
  19.   CrawlFile = 'TODAY.TXT'     ;name of the file you want to display
  20.   CrawlDelay = 30             ;seconds to wait to start
  21.   ThisLine
  22.   NextLine
  23.   LinePtr
  24.   OldTimer
  25.   Crawl
  26.  
  27.  
  28. ;----- Setup
  29.  
  30. OldTimer = Timer
  31.  
  32. if IdleProgram = nil
  33.    IdleProgram = Loc CrawlTask
  34. endif
  35.  
  36.  
  37. ;----- Procedures
  38.  
  39. Procedure FillLine
  40.    while length(ThisLine) < (ScreenWidth - 2)
  41.       if NextLine = ''
  42.          NextLine = Crawl[LinePtr]
  43.          LinePtr = LinePtr + 1
  44.          if NextLine = ''
  45.             NextLine = '* * * '
  46.          else
  47.             NextLine = NextLine + ' '
  48.          endif
  49.       endif
  50.       ThisLine = ThisLine + Left(NextLine,1)
  51.       delete(NextLine,1,1)
  52.    endwhile
  53. EndProc
  54.  
  55.  
  56. Procedure CrawlTask
  57. var X
  58.  
  59. ;   if Hour = 1
  60.        ;this is where you can start something at 1:00 in the morning
  61. ;   endif
  62.  
  63.    while not KbdReady and (Timer - OldTimer < (CrawlDelay * 18))
  64.    EndWhile
  65.  
  66.    OldTimer = Timer
  67.    if KbdReady then Return
  68.  
  69.    ThisLine = ' * * * * * * * * * * '
  70.    LinePtr = 1
  71.    NextLine = ''
  72.  
  73.    ;----- Read the text file.
  74.  
  75.    if NumberOfElements(Crawl) = 0
  76.       CrawlFile = ExistOnPath(CrawlFile)
  77.       if CrawlFile = ''
  78.          IdleProgram = Nil
  79.          Return
  80.       endif
  81.       ReadTextFile (CrawlFile,Crawl)
  82.       if Crawl[NumberOfElements(Crawl)] > ''
  83.          AppendArray(Crawl,'')
  84.       endif
  85.       AppendArray(Crawl,'###')
  86.       AppendArray(Crawl,'')
  87.    endif
  88.  
  89.    SetTopWindow StatusWindow
  90.    while not KbdReady
  91.       if LinePtr > NumberOfElements(Crawl) then LinePtr = 1
  92.       FillLine
  93.       X = Timer
  94.       if (X mod 2 = 0) and (X <> OldTimer)
  95.          GotoXY 2 1
  96.          Write ThisLine
  97.          delete(ThisLine,1,1)
  98.          OldTimer = X
  99.       endif
  100.    endwhile
  101.  
  102.    ClearScreen
  103.    WriteCenter StatusLineText
  104.    SetWindowUnder (StatusWindow,StatusWindow + 1)
  105.    OldTimer = Timer
  106. EndProc
  107.  
  108.  
  109.